package com.zbs.framework.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "ip-block")
public class IpInterceptorConfig {
    public static boolean ENABLE = false;
    public static Integer LIMIT_TIME = 10 * 1000;
    public static Integer LIMIT_NUM = 5;
    public static Integer MIN_SAFE_TIME = 5000;

    public void setEnable(boolean enable) {
        IpInterceptorConfig.ENABLE = enable;
    }

    public void setLimitTime(Integer limitTime) {
        IpInterceptorConfig.LIMIT_TIME = limitTime * 1000;
    }

    public void setLimitNum(Integer limitNum) {
        IpInterceptorConfig.LIMIT_NUM = limitNum;
    }

    public void setMinSafeTime(Integer minSafeTime) {
        IpInterceptorConfig.MIN_SAFE_TIME = minSafeTime * 1000;
    }
}
